<html>
<head>
    <title>New Profile Reminder</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <script type="text/javascript" src="<?=base_url()?>resource/js/jquery.js"></script>
    
    <link rel="stylesheet" href='<?=base_url()?>resource/css/style.css' type="text/css"/>
    
    <link rel="stylesheet" type="text/css" href="<?=base_url()?>resource/css/jquery.datetimepicker.css" />
    <script src="<?=base_url()?>resource/js/jquery.datetimepicker.js"></script>
    
    <link rel="stylesheet" type="text/css" href="<?=base_url()?>resource/css/jquery.autocompleter.css" />
    <script src="<?=base_url()?>resource/js/jquery.autocompleter.js"></script>
    <style>
        .input-div table tr{display:block;}
    </style>
</head>
<body>
<?php 
$weekarr = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$week = $weekarr[date("w")];
?>
    <div class="reminder-header">
        <h3><?=$profilename?></h3>
    </div>
    <div class="positiondiv">
        <table>
            <tr>
                <td class="td-left">
                    <img src="<?=base_url()?>resource/img/home_ico.png" width="21" height="17">
                    Reminder > New Profile Reminder
                </td>
                <td class="td-right">
                    <img src="<?=base_url()?>resource/img/menu2.png" width="27" height="24">Today is <?=$week?>,<?=date('M d,Y')?>
                </td>
            </tr>
        </table>
    </div>
    <div class="input-div" style="border:1px solid #C9C9C9;width:95%;border-radius:5px;margin:0px auto 20px;">
        <form action="<?=base_url('reminder/new_reminder')?>" method="post" onkeydown="if(event.keyCode==13)return false;" onsubmit="return checkform()">
            <input type='hidden' name="type" id="type" value="<?=$type?>" />
            <input type='hidden' name="association" id="association" value="<?=$worker['id']?>" />
            <input type='hidden' name="noticeid" id="type" value="<?=$notice['id']?>" />
            <input type='hidden' name="pickupid" id="pickupid" value="<?=$pickup['id']?>" />
            <table>
                <tr>
                    <td colspan="2">
                        <h3>.
                            <?php if($type == 2){
                                echo 'Applay Reminder';
                            }else if($type == 1){
                                echo 'Pick-up Reminder';
                            }else{
                                echo "Normal Reminder";
                            }?>
                        </h3>
                    </td>
                </tr>
                <?php if($type > 0){?>
                <tr>
                    <td class="nametd">
                        <?php if($type == 2){
                            echo 'Applay Time';
                        }else if($type == 1){
                            echo 'Arrived Time';
                        }else{
                            echo "Other Time";
                        }?>
                    </td>
                    <td><?=date("M d,Y",$time)?></td>
                </tr>
                <?php }?>
                <tr>
                    <td class="nametd">Notice Date:</td>
                    <td>
                        <input type="text" name="noticedate" id="noticedate" style="width:120px;" readonly="readonly" value="<?=date('Y-m-d',$notice['noticedate'])?>"/>
                        <span class="err" id="dateerr">*</span>
                    </td>
                </tr>
                <tr>
                    <td class="nametd">Notice Time:</td>
                    <td>
                        <input type="text" name="noticetime" id="noticetime" style="width:80px;" readonly="readonly" value="<?=$notice['noticetime']?>"/>
                        <span class="err" id="timeerr">*</span>
                    </td>
                </tr>
                <tr>
                    <td class="nametd">Notice Title:</td>
                    <td>
                        <input type="text" name="title" style="width:200px;" value="<?=$notice['title']?>"/>
                        <span class="err" id="titleerr">*</span>
                    </td>
                </tr>
                <?php if($type == 1){?>
                <tr class="pickup">
                    <td class="nametd">Flight Number:</td>
                    <td><input type="text" name="fltno" style="width:200px;" value="<?=$pickup['fltno']?>"/>
                        <span class="err" id="fltnoerr">*</span>
                    </td>
                </tr>
                <tr class="pickup">
                    <td class="nametd">The Terminal:</td>
                    <td>
                        <input type="text" name="terminal" style="width:200px;" value="<?=$pickup['terminal']?>"/>
                        <span class="err" id="terminalerr">*</span>
                    </td>
                </tr>
                <tr class="pickup">
                    <td class="nametd">Arrive Time:</td>
                    <td>
                        <input type="text" name="arrivetime" id="arrivetime" readonly="readonly" style="width:200px;" value="<?=date('Y-m-d H:m',$pickup['arrivetime'])?>"/>
                        <span class="err" id="arrivetimeerr">*</span>
                    </td>
                </tr>
                <?php }?>
                <tr>
                    <td class="nametd">Notice Comment:</td>
                    <td>
                        <textarea name="comment" style="height:60px;width:200px;"><?=$notice['comment']?></textarea>
                    </td>
                </tr>
                <tr><td class="nametd">Candidate:</td><td><?=$worker['name']?></td></tr>
                <tr>
                    <td class="nametd">Publicity:</td>
                    <td>
                        <input type="radio" name="ispublic" value="0" checked="checked" id="no" /><label for="no">No</label>
                        <input type="radio" name="ispublic" value="1" id="yes" /><label for="yes">Yes</label>
                    </td>
                </tr>
                <tr><td class="nametd"></td><td><input type='submit' value='Submit'/></td></tr>
            </table>
        </form>
    </div>
<script>
if($("#association").val() > 0){
    $("input[name='ispublic']:eq(<?=$notice['ispublic']?>)").attr("checked","checked");
}
$('#noticetime').datetimepicker({
    datepicker:false,
    format:'H:i',
    step:5
});

$('#arrivetime').datetimepicker({
    format:"Y-m-d H:i",
    step:10
});

function checkform(){
    var flag = true;
    if($("input[name='noticedate']").val() == ''){
        $("#dateerr").html("Please select notice date.");
        flag = false;
    }else{
        $("#dateerr").html("*");
    }
    
    if($("input[name='noticetime']").val() == ''){
        $("#timeerr").html("Please select notice time.");
        flag = false;
    }else{
        $("#timeerr").html("*");
    }
    
    if($.trim($("input[name='title']").val()) == ''){
        $("#titleerr").html("Please input title.");
        flag = false;
    }else{
        $("#titleerr").html("*");
    }
    
    var type = $("#type").val();
    if(type == 1){
        if($.trim($("input[name='fltno']").val()) == ''){
            $("#fltnoerr").html("Please input flight number.");
            flag = false;
        }else{
            $("#fltnoerr").html("*");
        }
        
        if($.trim($("input[name='terminal']").val()) == ''){
            $("#terminalerr").html("Please input the terminal.");
            flag = false;
        }else{
            $("#terminalerr").html("*");
        }
        
        if($("input[name='arrivetime']").val() == ''){
            $("#arrivetimeerr").html("Please select arrive time.");
            flag = false;
        }else{
            $("#arrivetimeerr").html("*");
        }
    }
    
    return flag;
}

$('#noticedate').datetimepicker({
    format:"Y-m-d",      //格式化日期
    timepicker:false,    //关闭时间选项
});
</script>
</body>
</html>